﻿<xsl:stylesheet version="1.0" 
	xmlns:date="http://exslt.org/dates-and-times" xmlns:ebe="http://cks/ebemethods"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:string="http://exslt.org/strings"
	exclude-result-prefixes="date">

<xsl:param name="IsBlogOwner" />
<xsl:param name="RelativeUrl" />

<xsl:output omit-xml-declaration="yes" />

<xsl:template match="/">

	<xsl:apply-templates select="rows/row"/>

</xsl:template>

<xsl:template match="row">
	<xsl:variable name="publishedDate" select="date:parseDate(PublishedDate, 'yyyy-MM-dd HH:mm:ss')"/>

	<h2>
		<xsl:value-of select="Title"/>
	</h2>
		
	<div id="content">
		<p class="postingdetail">
			<xsl:if test="Categories != ''">
				<strong>Tags:</strong>&#160;
				 <xsl:for-each select="string:split(CategoriesAsText, ';')">
				 	<a href="{ebe:createTagUrl(.)}">
					 	<xsl:value-of select="."/>
				 	</a>
				 	<xsl:if test="position() != last()">&#160;&#183;&#160;</xsl:if>
				 </xsl:for-each>
			</xsl:if>
		</p>

		<xsl:if test="$IsBlogOwner = 'True'">
			<p>
				<a>
					<xsl:attribute name="href">
						/<xsl:value-of select="substring-after(FileDirRef,'#')"/>/EditPost.aspx?ID=<xsl:value-of select="ID"/>
					</xsl:attribute>
					[Edit Post]
				</a>
			</p>
		</xsl:if>

		<div id="entry">
			<xsl:value-of select="Body" disable-output-escaping="yes"/>
		</div>

		<p class="postingdetail">
			<xsl:value-of select="date:format-date($publishedDate, 'MMMM d, yyyy')"/>
			&#183;
			Posted by <xsl:value-of select="substring-after(Author,'#')"/>
		</p>
		
	</div>
</xsl:template>  
</xsl:stylesheet>
